<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>while循环</title>
  </head>
  <body>
    <script>
      var sum = 0;
      var a = 1;
      while (a <= 10) {
        sum += a;
        a++;
      }
      console.log("sum的值:", sum);

      var sum1 = 0;
      var a1 = 1;
      do {
        sum1 += a1;
        a1++;
      } while (a1 <= 10);
      console.log("sum1的值:", sum1);
    </script>
  </body>
</html>
